package com.example.demo.entity.vo;

import com.example.demo.commons.emum.HttpStatusCode;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author wfj
 */

@Data
@AllArgsConstructor
public class ResultVO {

    private Integer code;

    private String msg;

    private Object data;

    public ResultVO(HttpStatusCode httpStatusCode) {
        this.code = httpStatusCode.getCode();
        this.msg = httpStatusCode.getMessage();
    }
    public ResultVO(HttpStatusCode httpStatusCode,Object data) {
        this.code = httpStatusCode.getCode();
        this.msg = httpStatusCode.getMessage();
        this.data = data;
    }
    public static ResultVO ok(){
        return new ResultVO(HttpStatusCode.OK);
    }
    public static ResultVO ok(Object data){
        return new ResultVO(HttpStatusCode.OK,data);
    }
    public static ResultVO fail(){
        return new ResultVO(HttpStatusCode.BAD_REQUEST);
    }

}